// 注册逻辑拆分
export async function handleRegister({
  registerForm,
  setRegisterErrors,
  setLoading,
  register,
  validateRegisterForm,
  switchTab,
  uni,
  rawForm
}) {
  const errors = validateRegisterForm(rawForm || registerForm);
  setRegisterErrors(errors);
  if (Object.keys(errors).length > 0) {
    return;
  }
  try {
    setLoading(true);
    await register(registerForm);
    uni.showToast({ title: '注册成功', icon: 'success' });
    setTimeout(() => {
      switchTab('login');
    }, 1500);
  } catch (error) {
    uni.showToast({ title: error.message || '注册失败', icon: 'none' });
  } finally {
    setLoading(false);
  }
} 